home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / HYP / E-G / educationstacks.sea / Circuits / card_5105.txt < prev    next >
Text File  |  1989-02-26  |  5KB  |  232 lines

  1. -- card: 5105 from stack: in
  2. -- bmap block id: 5621
  3. -- flags: 4000
  4. -- background id: 2693
  5. -- name: Network
  6. ----- HyperTalk script -----
  7. on calculate
  8.  
  9.   get char 1 of card field "R1"
  10.   if it="+" then
  11.     delete char 1 of card field "R1"
  12.   end if
  13.   put card field "R1" into R1
  14.   put abs(R1) into R1
  15.   put R1 into card field "R1"
  16.  
  17.   get char 1 of card field "R2"
  18.   if it="+" then
  19.     delete char 1 of card field "R2"
  20.   end if
  21.   put card field "R2" into R2
  22.   put abs(R2) into R2
  23.   put R2 into card field "R2"
  24.  
  25.   get char 1 of card field "R3"
  26.   if it="+" then
  27.     delete char 1 of card field "R3"
  28.   end if
  29.   put card field "R3" into R3
  30.   put abs(R3) into R3
  31.   put R3 into card field "R3"
  32.  
  33.   get char 1 of card field "R4"
  34.   if it="+" then
  35.     delete char 1 of card field "R4"
  36.   end if
  37.   put card field "R4" into R4
  38.   put abs(R4) into R4
  39.   put R4 into card field "R4"
  40.  
  41.   get char 1 of card field "R5"
  42.   if it="+" then
  43.     delete char 1 of card field "R5"
  44.   end if
  45.   put card field "R5" into R5
  46.   put abs(R5) into R5
  47.   put R5 into card field "R5"
  48.  
  49.   if R1=0 and R2=0 and R3=0 and R4=0 then
  50.  
  51.     put 0 into RE
  52.  
  53.   else
  54.  
  55.     if R5=0 and R1=0 and R2=0 then
  56.       put R3*R4/(R3+R4) into RE
  57.  
  58.     else
  59.  
  60.       if R5=0 and R3=0 and R4=0 then
  61.         put R1*R2/(R1+R2) into RE
  62.  
  63.       else
  64.  
  65.         put (R2*R3*(R1+R4)+R1*R4*(R2+R3)+R5*(R1+R3)*(R2+R4))/ ((R1+R2)*(R3+R4)+R5*(R1+R2+R3+R4)) into RE
  66.  
  67.       end if
  68.     end if
  69.   end if
  70.  
  71.   set numberFormat to "0.000"
  72.  
  73.   put RE/1 into card field "Req"
  74.  
  75. end calculate
  76.  
  77. on closeField
  78.  
  79.   put "" into card field "Req"
  80.  
  81. end closeField
  82.  
  83.  
  84.  
  85. -- part 4 (field)
  86. -- low flags: 00
  87. -- high flags: 0000
  88. -- rect: left=250 top=32 right=47 bottom=301
  89. -- title width / last selected line: 0
  90. -- icon id / first selected line: 0 / 0
  91. -- text alignment: 65535
  92. -- font id: 3
  93. -- text size: 12
  94. -- style flags: 256
  95. -- line height: 16
  96. -- part name: R3
  97.  
  98.  
  99. -- part 6 (field)
  100. -- low flags: 00
  101. -- high flags: 0000
  102. -- rect: left=134 top=32 right=47 bottom=185
  103. -- title width / last selected line: 0
  104. -- icon id / first selected line: 0 / 0
  105. -- text alignment: 65535
  106. -- font id: 3
  107. -- text size: 12
  108. -- style flags: 256
  109. -- line height: 16
  110. -- part name: R1
  111.  
  112.  
  113. -- part 7 (field)
  114. -- low flags: 00
  115. -- high flags: 0000
  116. -- rect: left=135 top=202 right=217 bottom=186
  117. -- title width / last selected line: 0
  118. -- icon id / first selected line: 0 / 0
  119. -- text alignment: 65535
  120. -- font id: 3
  121. -- text size: 12
  122. -- style flags: 256
  123. -- line height: 16
  124. -- part name: R2
  125.  
  126.  
  127. -- part 8 (field)
  128. -- low flags: 00
  129. -- high flags: 0000
  130. -- rect: left=250 top=202 right=217 bottom=301
  131. -- title width / last selected line: 0
  132. -- icon id / first selected line: 0 / 0
  133. -- text alignment: 65535
  134. -- font id: 3
  135. -- text size: 12
  136. -- style flags: 256
  137. -- line height: 16
  138. -- part name: R4
  139.  
  140.  
  141. -- part 9 (field)
  142. -- low flags: 00
  143. -- high flags: 0000
  144. -- rect: left=139 top=114 right=130 bottom=196
  145. -- title width / last selected line: 0
  146. -- icon id / first selected line: 0 / 0
  147. -- text alignment: 65535
  148. -- font id: 3
  149. -- text size: 12
  150. -- style flags: 256
  151. -- line height: 16
  152. -- part name: R5
  153.  
  154.  
  155. -- part 10 (field)
  156. -- low flags: 01
  157. -- high flags: 0000
  158. -- rect: left=202 top=266 right=281 bottom=253
  159. -- title width / last selected line: 0
  160. -- icon id / first selected line: 0 / 0
  161. -- text alignment: 65535
  162. -- font id: 3
  163. -- text size: 12
  164. -- style flags: 256
  165. -- line height: 16
  166. -- part name: Req
  167.  
  168.  
  169. -- part 11 (button)
  170. -- low flags: 00
  171. -- high flags: 8003
  172. -- rect: left=373 top=149 right=171 bottom=473
  173. -- title width / last selected line: 0
  174. -- icon id / first selected line: 0 / 0
  175. -- text alignment: 1
  176. -- font id: 0
  177. -- text size: 12
  178. -- style flags: 0
  179. -- line height: 16
  180. -- part name: Calculate
  181. ----- HyperTalk script -----
  182. on mouseUp
  183.   send calculate
  184. end mouseUp
  185.  
  186.  
  187.  
  188. -- part 12 (field)
  189. -- low flags: 01
  190. -- high flags: 0007
  191. -- rect: left=352 top=49 right=113 bottom=508
  192. -- title width / last selected line: 0
  193. -- icon id / first selected line: 0 / 0
  194. -- text alignment: 0
  195. -- font id: 3
  196. -- text size: 12
  197. -- style flags: 0
  198. -- line height: 16
  199. -- part name: 
  200.  
  201.  
  202. -- part contents for background part 8
  203. ----- text -----
  204. C5. Resistor Network
  205.  
  206. -- part contents for card part 6
  207. ----- text -----
  208. 10
  209.  
  210. -- part contents for card part 4
  211. ----- text -----
  212. 20
  213.  
  214. -- part contents for card part 7
  215. ----- text -----
  216. 20
  217.  
  218. -- part contents for card part 8
  219. ----- text -----
  220. 10
  221.  
  222. -- part contents for card part 9
  223. ----- text -----
  224. 10
  225.  
  226. -- part contents for card part 12
  227. ----- text -----
  228. Find the equivalent resistance by apply-ing Kirchhoff's rules. That is, put a known emf across the term-inals and calculate the current through the emf using Kirchhoff's rules.  The emf divided by the current is the equivalent resis-tance.
  229.  
  230. -- part contents for card part 10
  231. ----- text -----
  232. 14.000